<?php
$model_object = 'model_' . strtolower($_POST['path']) . "_" . $module_name_small;
$language_path = strtolower($_POST['path'] . '/' . $module_name_small);

$list_db_fields = '';

ob_start();
foreach ($list_fields as $each_field) {
	echo "\r" . '				\'' . $each_field['name'] . '\' => $result[\'' . $each_field['name'] . '\'],';
}
$list_db_fields = ob_get_clean();


$maches_arr = array (
	'/@controller_name@/',
	'/@language_path@/',
	'/@model_object@/',
	'/@model_path@/',
	'/@module_name@/',
	'/@module_name_small@/',
	'/@module_table_name@/',
	'/@module_primary_key@/',
	'/@module_path@/',
	'/@list_db_fields@/',	
);

$replace_arr = array (
	$controller_name,
	$language_path,
	$model_object,
	$model_path,
	$module_name,
	$module_name_small,
	$module_table_name,
	$module_primary_key,
	$module_path,
	$list_db_fields,	
);

//preg_match_all('/@([^@]+)@/', $catalog_controller_file_contents, $maches);
//sort($maches['1']);
//print_r(array_unique($maches['1']));
	
$catalog_controller_file_contents = preg_replace($maches_arr, $replace_arr, $catalog_controller_file_contents);
?>